﻿using System.Linq;
using System.Windows.Controls;
using Scheduler;
using UnitTesting.Middlewares;

namespace UnitTesting.Engine
{
    public class MiddlewareFactory : IMiddlewareFactory
    {


        public Middleware CreateMiddleware(params object[] userData)
        {
            var st = (int)userData[0];
            var devInfo = new  DeviceMainKind();

            switch (userData[1])
            {
                case DeviceMainKind.None:
                    return new BaseTesterMiddleware();
                case DeviceMainKind.Aoi:
                    if (userData.ElementAtOrDefault(2) is true)
                    {
                        return new LeftAoiMiddleware();
                    }
                    else
                    {
                        return new RightAoiMiddleware();
                    } 
 
                case DeviceMainKind.WorkTester:

                    return new BaseTesterMiddleware();
                default:
                    return null;
            }
        }
    }
    public enum DeviceMainKind
    {
        None = 0,
        Aoi,
        WorkTester

    }
}